/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package formulagraph;

/**
 *
 * @author soler4888
 */
public class Texto {
    public static final String VERDANA = "Verdana";
    private String texto;
    private double x;
    private double y;
    private int tamFont;
    private String tipoFuente;

    public Texto(String texto, double x, double y, int tamFont, String tipoFuente) {
        this.texto = texto;
        this.x = x;
        this.y = y;
        this.tamFont = tamFont;
        this.tipoFuente = tipoFuente;
    }
    
    public Texto(String texto, double x, double y, int tamFont) {
        this(texto, x, y, tamFont, Texto.VERDANA);
    }
    
    public Texto(String texto, double x, double y) {
        this(texto, x, y, 12, Texto.VERDANA);
    }
    
    public String dibujar() {
        StringBuilder builder = new StringBuilder();
        
        // Texto
        builder.append("<text ");
        builder.append("x=\"").append(x).append("\"");
        builder.append("y=\"").append(y).append("\"");
        builder.append("font-size=\"").append(tamFont).append("\"");
        builder.append("font-family=\"").append(tipoFuente).append("\"");
        builder.append(">\n");
        builder.append(texto).append("\n");
        builder.append("</text>\n");
        
        return builder.toString();
    }
}
